package belf.migrate.api.taskconf;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SyncStatus {
    @JsonProperty("jobId")
    private long jobId;

    @JsonProperty("taskId")
    private long taskId;

    @JsonProperty("tableName")
    private String tableName;

    @JsonProperty("last")
    private String last;

    public String toJson() throws JsonProcessingException {
        ObjectMapper mapper = new ObjectMapper();
        return mapper.writer().writeValueAsString(this);
    }
}